# <Makefile Template>
# < Lailin>
# < Modified from Yusheng's template>

#<Related Directory>

#<Code Search Path>

#<ROOT Lib and Include>
RootLibs=`root-config --libs`
RootHeader=`root-config --cflags`

#<Compiler Setting>
INC = -I. 
OPT = -O3
CC = g++ $(OPT) $(INC) $(RootHeader) 

#<Code>
SRC_CPP=$(wildcard *.cpp )
OBJ_CPP=$(SRC_CPP:.cpp=.o)
SRC_CXX=$(wildcard *.cxx)
OBJ_CXX=$(SRC_CXX:.cxx=.o)
SRC_C=$(wildcard *.C)
OBJ_C=$(SRC_C:.C=.o)
OBJ_EXTRA=$(wildcard *.o)
EXE=run.exe

#<Rules>

all :  $(EXE)


$(EXE) : $(OBJ_CPP) $(OBJ_CXX) $(OBJ_C)
	@echo "<Now link objects to executable>"
	$(CC) -o $@ $^ $(OBJ_EXTRA) $(RootLibs)

$(OBJ_CPP) : %.o : %.cpp
	$(CC) -c $< -o $@

$(OBJ_CXX) : %.o : %.cxx
	$(CC) -c $< -o $@

$(OBJ_C) : %.o : %.C
	$(CC) -c $< -o $@

clean:
	\rm -f *.o *.so *.exe
cleanall:
	\rm -f *.o *.so *.exe
